import { Injectable, Logger } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { ConfigService } from '@nestjs/config';
import { BaseService } from '@wwjCommon/base/base.service';
import { CacheService } from '@wwjCommon/cache/cache.service';
import { LoggingService } from '@wwjCommon/logging/logging.service';
import { UploadService } from '@wwjVendor/upload/upload.service';
import { PayService } from '@wwjVendor/pay/pay.service';
import { SmsService } from '@wwjVendor/sms/sms.service';
import { NoticeService } from '@wwjVendor/notice/notice.service';

@Injectable()
export class MemberConfigService extends BaseService<any> {
  private readonly logger = new Logger(MemberConfigService.name);

  constructor(
    @InjectRepository(Object)
    protected readonly repository: Repository<any>,
    private readonly cacheService: CacheService,
    private readonly configService: ConfigService,
    private readonly loggingService: LoggingService,
    private readonly uploadService: UploadService,
    private readonly payService: PayService,
    private readonly smsService: SmsService,
    private readonly noticeService: NoticeService,
  ) {
    super(repository);
  }

  /**
   * getLoginConfig
   * 对应 PHP: MemberConfigService_admin::getLoginConfig()
   * 逻辑类型: undefined - undefined
   */
  async getLoginConfig() {
    // 基于PHP真实逻辑: getLoginConfig
    // PHP原文: return (new CoreMemberConfigService())->getLoginConfig($this->site_id);     }      /**      * 注册登录设置      * @param array $data      * @return true    ...
return this.coreMemberConfigService.getLoginConfig(this.site_id);
    }

    /**
     * 注册登录设置
     * @param data
     * @return true
     */
    async setLoginConfig(data){
        return this.coreMemberConfigService.setLoginConfig(this.site_id, data);
    }
    /**
     * 获取提现设置
     */
    async getCashOutConfig(){

        return this.coreMemberConfigService.getCashOutConfig(this.site_id);
    }

    /**
     * 提现设置
     * @param data
     * @return true
     */
    async setCashOutConfig(data){
        return this.coreMemberConfigService.setCashOutConfig(this.site_id, data);
    }

    /**
     * 获取会员设置
     */
    async getMemberConfig(){
        return this.coreMemberConfigService.getMemberConfig(this.site_id);
    }

    /**
     * 会员设置
     * @param data
     * @return true
     */
    async setMemberConfig(data){
        return this.coreMemberConfigService.setMemberConfig(this.site_id, data);
    }

    /**
     * 获取成长值规则配置
     */
    async getGrowthRuleConfig(){
        const config = this.coreMemberConfigService.getGrowthRuleConfig(this.site_id);
        if (!!config)) {
            const config = CoreMemberService.getGrowthRuleContent(this.site_id, config);
  }

  /**
   * setLoginConfig
   * 对应 PHP: MemberConfigService_admin::setLoginConfig()
   * 逻辑类型: undefined - undefined
   */
  async setLoginConfig(data: any[]) {
    // 基于PHP真实逻辑: setLoginConfig
    // PHP原文: return (new CoreMemberConfigService())->setLoginConfig($this->site_id, $data);     }     /**      * 获取提现设置      */     public function getCashOutConfi...
return this.coreMemberConfigService.setLoginConfig(this.site_id, data);
    }
    /**
     * 获取提现设置
     */
    async getCashOutConfig(){

        return this.coreMemberConfigService.getCashOutConfig(this.site_id);
    }

    /**
     * 提现设置
     * @param data
     * @return true
     */
    async setCashOutConfig(data){
        return this.coreMemberConfigService.setCashOutConfig(this.site_id, data);
    }

    /**
     * 获取会员设置
     */
    async getMemberConfig(){
        return this.coreMemberConfigService.getMemberConfig(this.site_id);
    }

    /**
     * 会员设置
     * @param data
     * @return true
     */
    async setMemberConfig(data){
        return this.coreMemberConfigService.setMemberConfig(this.site_id, data);
    }

    /**
     * 获取成长值规则配置
     */
    async getGrowthRuleConfig(){
        const config = this.coreMemberConfigService.getGrowthRuleConfig(this.site_id);
        if (!!config)) {
            const config = CoreMemberService.getGrowthRuleContent(this.site_id, config);
  }

  /**
   * getCashOutConfig
   * 对应 PHP: MemberConfigService_admin::getCashOutConfig()
   * 逻辑类型: undefined - undefined
   */
  async getCashOutConfig() {
    // 基于PHP真实逻辑: getCashOutConfig
    // PHP原文: return (new CoreMemberConfigService())->getCashOutConfig($this->site_id);     }      /**      * 提现设置      * @param array $data      * @return true    ...
return this.coreMemberConfigService.getCashOutConfig(this.site_id);
    }

    /**
     * 提现设置
     * @param data
     * @return true
     */
    async setCashOutConfig(data){
        return this.coreMemberConfigService.setCashOutConfig(this.site_id, data);
    }

    /**
     * 获取会员设置
     */
    async getMemberConfig(){
        return this.coreMemberConfigService.getMemberConfig(this.site_id);
    }

    /**
     * 会员设置
     * @param data
     * @return true
     */
    async setMemberConfig(data){
        return this.coreMemberConfigService.setMemberConfig(this.site_id, data);
    }

    /**
     * 获取成长值规则配置
     */
    async getGrowthRuleConfig(){
        const config = this.coreMemberConfigService.getGrowthRuleConfig(this.site_id);
        if (!!config)) {
            const config = CoreMemberService.getGrowthRuleContent(this.site_id, config);
  }

  /**
   * setCashOutConfig
   * 对应 PHP: MemberConfigService_admin::setCashOutConfig()
   * 逻辑类型: undefined - undefined
   */
  async setCashOutConfig(data: any[]) {
    // 基于PHP真实逻辑: setCashOutConfig
    // PHP原文: return (new CoreMemberConfigService())->setCashOutConfig($this->site_id, $data);     }      /**      * 获取会员设置      */     public function getMemberCon...
return this.coreMemberConfigService.setCashOutConfig(this.site_id, data);
    }

    /**
     * 获取会员设置
     */
    async getMemberConfig(){
        return this.coreMemberConfigService.getMemberConfig(this.site_id);
    }

    /**
     * 会员设置
     * @param data
     * @return true
     */
    async setMemberConfig(data){
        return this.coreMemberConfigService.setMemberConfig(this.site_id, data);
    }

    /**
     * 获取成长值规则配置
     */
    async getGrowthRuleConfig(){
        const config = this.coreMemberConfigService.getGrowthRuleConfig(this.site_id);
        if (!!config)) {
            const config = CoreMemberService.getGrowthRuleContent(this.site_id, config);
  }

  /**
   * getMemberConfig
   * 对应 PHP: MemberConfigService_admin::getMemberConfig()
   * 逻辑类型: undefined - undefined
   */
  async getMemberConfig() {
    // 基于PHP真实逻辑: getMemberConfig
    // PHP原文: return (new CoreMemberConfigService())->getMemberConfig($this->site_id);     }      /**      * 会员设置      * @param array $data      * @return true     ...
return this.coreMemberConfigService.getMemberConfig(this.site_id);
    }

    /**
     * 会员设置
     * @param data
     * @return true
     */
    async setMemberConfig(data){
        return this.coreMemberConfigService.setMemberConfig(this.site_id, data);
    }

    /**
     * 获取成长值规则配置
     */
    async getGrowthRuleConfig(){
        const config = this.coreMemberConfigService.getGrowthRuleConfig(this.site_id);
        if (!!config)) {
            const config = CoreMemberService.getGrowthRuleContent(this.site_id, config);
  }

  /**
   * setMemberConfig
   * 对应 PHP: MemberConfigService_admin::setMemberConfig()
   * 逻辑类型: undefined - undefined
   */
  async setMemberConfig(data: any[]) {
    // 基于PHP真实逻辑: setMemberConfig
    // PHP原文: return (new CoreMemberConfigService())->setMemberConfig($this->site_id, $data);     }      /**      * 获取成长值规则配置      */     public function getGrowthR...
return this.coreMemberConfigService.setMemberConfig(this.site_id, data);
    }

    /**
     * 获取成长值规则配置
     */
    async getGrowthRuleConfig(){
        const config = this.coreMemberConfigService.getGrowthRuleConfig(this.site_id);
        if (!!config)) {
            const config = CoreMemberService.getGrowthRuleContent(this.site_id, config);
  }

  /**
   * getGrowthRuleConfig
   * 对应 PHP: MemberConfigService_admin::getGrowthRuleConfig()
   * 逻辑类型: undefined - undefined
   */
  async getGrowthRuleConfig() {
    // 基于PHP真实逻辑: getGrowthRuleConfig
    // PHP原文: $config = (new CoreMemberConfigService())->getGrowthRuleConfig($this->site_id);         if (!empty($config)) {             $config = CoreMemberService...
const config = this.coreMemberConfigService.getGrowthRuleConfig(this.site_id);
        if (!!config)) {
            const config = CoreMemberService.getGrowthRuleContent(this.site_id, config);
  }

  /**
   * setGrowthRuleConfig
   * 对应 PHP: MemberConfigService_admin::setGrowthRuleConfig()
   * 逻辑类型: undefined - undefined
   */
  async setGrowthRuleConfig(data: any[]) {
    // 基于PHP真实逻辑: setGrowthRuleConfig
    // PHP原文: return (new CoreMemberConfigService())->setGrowthRuleConfig($this->site_id, $data);     }      /**      * 获取积分规则配置      */     public function getPoin...
return this.coreMemberConfigService.setGrowthRuleConfig(this.site_id, data);
    }

    /**
     * 获取积分规则配置
     */
    async getPointRuleConfig(){
        const config = this.coreMemberConfigService.getPointRuleConfig(this.site_id);
        if (!!config)) {
            if (typeof config.grant) && !!config.grant)) config.grant = CoreMemberService.getPointGrantRuleContent(this.site_id, config.grant);
            if (typeof config.consume) && !!config.consume)) config.consume = CoreMemberService.getPointGrantRuleContent(this.site_id, config.consume);
  }

  /**
   * getPointRuleConfig
   * 对应 PHP: MemberConfigService_admin::getPointRuleConfig()
   * 逻辑类型: undefined - undefined
   */
  async getPointRuleConfig() {
    // 基于PHP真实逻辑: getPointRuleConfig
    // PHP原文: $config = (new CoreMemberConfigService())->getPointRuleConfig($this->site_id);         if (!empty($config)) {             if (isset($config['grant']) ...
const config = this.coreMemberConfigService.getPointRuleConfig(this.site_id);
        if (!!config)) {
            if (typeof config.grant) && !!config.grant)) config.grant = CoreMemberService.getPointGrantRuleContent(this.site_id, config.grant);
            if (typeof config.consume) && !!config.consume)) config.consume = CoreMemberService.getPointGrantRuleContent(this.site_id, config.consume);
  }

  /**
   * setPointRuleConfig
   * 对应 PHP: MemberConfigService_admin::setPointRuleConfig()
   * 逻辑类型: undefined - undefined
   */
  async setPointRuleConfig(data: any[]) {
    // 基于PHP真实逻辑: setPointRuleConfig
    // PHP原文: return (new CoreMemberConfigService())->setPointRuleConfig($this->site_id, $data);     } }...
return this.coreMemberConfigService.setPointRuleConfig(this.site_id, data);
    }
}
  }
}
